/* about-dialog.vala
 *
 * Copyright (C) 2010, 2011  Richard Talbot-Watkins
 * Copyright (C) 2010, 2011  Dave Jeffery
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Authors:
 *  Richard Talbot-Watkins <richtw1@gmail.com>
 * 	Dave Jeffery <david.richard.jeffery@gmail.com>
 */

using Gtk;

/**
 * About dialog box.
 *
 * @author Dave Jeffery <david.richard.jeffery@gmail.com>
 * @version 2010.1231
 * @since 0.1
 */
private class BeebSpriter.Credits : AboutDialog {
	/**
	 * Constructor for the About dialog box.
	 *
	 * @param calling_window Window from which the about dialg box was called.
	 */
	public Credits (Window calling_window) {
		set_transient_for (calling_window);
		program_name = "Beeb Spriter";
		version = "0.1";
		comments = _("BBC Microcomputer and Acorn Electron Sprite Designer");
		copyright = "© 2010, 2011 Richard Talbot-Watkins\n"
					+ "© 2010, 2011 Dave Jeffery";
		website = "http://www.retrosoftware.co.uk/";
		website_label = "Retro Software";

		var logo_path = FileUtilities.data_directory.get_child ("images")
											.get_child ("about-icon.png");

		try {
			logo = new Gdk.Pixbuf.from_file (logo_path.get_parse_name ());
		} catch (Error e) {
			stderr.printf ("Could not about dialog logo: %s\n", 
							e.message);
		}
		icon = calling_window.icon;

		var licence_path = FileUtilities.data_directory
											.get_child ("licence")
											.get_child ("about-licence");
        string read = "";
		try {
	        var data_stream = new DataInputStream (licence_path.read ());
    		string line;
    		// Read lines until end of file (null) is reached
    		while ((line = data_stream.read_line (null)) != null) {
        		read += line + "\n";
    		}
		} catch (Error e) {
			stderr.printf ("Could not load licence file: %s\n", 
							e.message);
		}
		authors = {"Richard Talbot-Watkins", "Dave Jeffery", null};
		license = read;
		wrap_license = true;
	}
}
